<?php

namespace app\index\validate\cash;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class Cash
 * @package app\index\validate\cash
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 */
class Cash extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'	=> 'isId',
		'memberId'	=> 'integer|egt:0|max:11',
		'nid'	=> 'scalar|max:50',
		'openid'	=> 'scalar|max:50',
		'total'	=> 'numeric',
		'amount'	=> 'numeric',
		'fee'	=> 'numeric',
		'payDesc'	=> 'scalar|max:100',
		'paymentNo'	=> 'scalar|max:64',
		'paymentTime'	=> 'likeId',
		'returnCode'	=> 'scalar|max:16',
		'returnMsg'	=> 'scalar|max:32',
		'status'	=> 'integer|egt:0|max:1',
		'checkStatus'	=> 'integer|egt:0|max:1',
		'channel'	=> 'integer|egt:0|max:3',
		'platform'	=> 'integer|max:2',
		'batchNo'	=> 'scalar|max:30',
		'batchId'	=> 'scalar|max:64',
		'created'	=> 'integer|egt:0|max:11',
		'updated'	=> 'integer|egt:0|max:11',
        'page'      => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id'	=> 'id',
		'memberId'	=> 'memberId',
		'nid'	=> 'nid',
		'openid'	=> 'openid',
		'total'	=> 'total',
		'amount'	=> 'amount',
		'fee'	=> 'fee',
		'payDesc'	=> 'payDesc',
		'paymentNo'	=> 'paymentNo',
		'paymentTime'	=> 'paymentTime',
		'returnCode'	=> 'returnCode',
		'returnMsg'	=> 'returnMsg',
		'status'	=> 'status',
		'checkStatus'	=> 'checkStatus',
		'channel'	=> 'channel',
		'platform'	=> 'platform',
		'batchNo'	=> 'batchNo',
		'batchId'	=> 'batchId',
		'created'	=> 'created',
		'updated'	=> 'updated',
        'page'      => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require'	=> '缺少:attribute',
		'id.isId'	=> '请设置正确的:attribute',
		'memberId.require'	=> '请输入:attribute',
		'memberId.integer' => ':attribute应该是整数',
		'memberId.egt'	=> ':attribute应该大于等于:rule',
		'memberId.max'	=> ':attribute长度不能超过:rule位',
		'nid.require'	=> '请输入:attribute',
		'nid.scalar' => ':attribute应该是字符串',
		'nid.max'	=> ':attribute长度不能超过:rule位',
		'openid.require'	=> '请输入:attribute',
		'openid.scalar' => ':attribute应该是字符串',
		'openid.max'	=> ':attribute长度不能超过:rule位',
		'total.require'	=> '请输入:attribute',
		'total.numeric' => ':attribute应该是数字',
		'amount.require'	=> '请输入:attribute',
		'amount.numeric' => ':attribute应该是数字',
		'fee.require'	=> '请输入:attribute',
		'fee.numeric' => ':attribute应该是数字',
		'payDesc.require'	=> '请输入:attribute',
		'payDesc.scalar' => ':attribute应该是字符串',
		'payDesc.max'	=> ':attribute长度不能超过:rule位',
		'paymentNo.require'	=> '请输入:attribute',
		'paymentNo.scalar' => ':attribute应该是字符串',
		'paymentNo.max'	=> ':attribute长度不能超过:rule位',
		'paymentTime.require'	=> '请选择:attribute',
		'paymentTime.isId'	=> '请选择正确的:attribute',
		'returnCode.require'	=> '请输入:attribute',
		'returnCode.scalar' => ':attribute应该是字符串',
		'returnCode.max'	=> ':attribute长度不能超过:rule位',
		'returnMsg.require'	=> '请输入:attribute',
		'returnMsg.scalar' => ':attribute应该是字符串',
		'returnMsg.max'	=> ':attribute长度不能超过:rule位',
		'status.require'	=> '请输入:attribute',
		'status.integer' => ':attribute应该是整数',
		'status.egt'	=> ':attribute应该大于等于:rule',
		'status.max'	=> ':attribute长度不能超过:rule位',
		'checkStatus.require'	=> '请输入:attribute',
		'checkStatus.integer' => ':attribute应该是整数',
		'checkStatus.egt'	=> ':attribute应该大于等于:rule',
		'checkStatus.max'	=> ':attribute长度不能超过:rule位',
		'channel.require'	=> '请输入:attribute',
		'channel.integer' => ':attribute应该是整数',
		'channel.egt'	=> ':attribute应该大于等于:rule',
		'channel.max'	=> ':attribute长度不能超过:rule位',
		'platform.require'	=> '请输入:attribute',
		'platform.integer' => ':attribute应该是整数',
		'platform.max'	=> ':attribute长度不能超过:rule位',
		'batchNo.require'	=> '请输入:attribute',
		'batchNo.scalar' => ':attribute应该是字符串',
		'batchNo.max'	=> ':attribute长度不能超过:rule位',
		'batchId.require'	=> '请输入:attribute',
		'batchId.scalar' => ':attribute应该是字符串',
		'batchId.max'	=> ':attribute长度不能超过:rule位',
		'created.require'	=> '请输入:attribute',
		'created.integer' => ':attribute应该是整数',
		'created.egt'	=> ':attribute应该大于等于:rule',
		'created.max'	=> ':attribute长度不能超过:rule位',
		'updated.require'	=> '请输入:attribute',
		'updated.integer' => ':attribute应该是整数',
		'updated.egt'	=> ':attribute应该大于等于:rule',
		'updated.max'	=> ':attribute长度不能超过:rule位',
        'page.require'      => '请输入:attribute',
        'page.integer'      => ':attribute应该是整数',
        'page.egt'          => ':attribute应该大于等于:rule',
        'page.max'          => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt'     => ':attribute应该大于等于:rule',
        'page_size.max'     => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index'  => ['page', 'page_size'],
        'read'   => ['id' => 'require'],
        'save'   => ['memberId', 'nid', 'openid', 'total', 'amount', 'fee', 'payDesc', 'paymentNo', 'paymentTime', 'returnCode', 'returnMsg', 'status', 'checkStatus', 'channel', 'platform', 'batchNo', 'batchId', 'created', 'updated'],
    ];

}
